//
//  YunOrderListModel.m
//  BaseProject
//
//  Created by 王盼盼 on 2024/10/22.
//  Copyright © 2024 wangpanpan. All rights reserved.
//

#import "YunOrderListModel.h"

@interface YunOrderListModel ()
//@property(nonatomic, assign) CGFloat cellHeight;
@end


@implementation YunOrderListModel
+ (NSDictionary *)mj_objectClassInArray {
    return @{@"yunOrderSubList":[YunOrderListModel class]};
}
+ (NSArray *)mj_ignoredPropertyNames {
    return @[@"statusDes", @"isSucceed", @"cellHeight"];
}
+ (NSArray *)mj_ignoredCodingPropertyNames {
    return @[@"statusDes", @"isSucceed", @"cellHeight"];
}
- (NSString *)statusDes {
    /// WAIT SUCCESS  (ACCEPTED:已受理,PROCESSING:处理中,FAIL:失败,SUCCESS:成功,CANCELING:撤销中,CANCELED:撤销成功,CANCEL_FAIL:撤销失败,FALLBACKING:回退中,FALLBACK_END:回退结束)
    if ([self.status isEqualToString:@"WAIT"]) {
        return @"待支付";
    } else if ([self.status isEqualToString:@"SUCCESS"]) {
        return @"支付成功";
    } else if ([self.status isEqualToString:@"ACCEPTED"]) {
        return @"已受理";
    } else if ([self.status isEqualToString:@"PROCESSING"]) {
        return @"处理中";
    } else if ([self.status isEqualToString:@"FAIL"]) {
        return @"失败";
    } else if ([self.status isEqualToString:@"CANCELING"]) {
        return @"撤销中";
    } else if ([self.status isEqualToString:@"CANCELED"]) {
        return @"撤销成功";
    } else if ([self.status isEqualToString:@"CANCEL_FAIL"]) {
        return @"撤销失败";
    } else if ([self.status isEqualToString:@"FALLBACKING"]) {
        return @"回退中";
    } else if ([self.status isEqualToString:@"FALLBACK_END"]) {
        return @"回退结束";
    } else if ([self.status isEqualToString:@"CANCEL"]) {
        return @"撤销成功";
    }
    return @"";
}
- (BOOL)isSucceed {
    return [self.status isEqualToString:@"SUCCESS"];
}
- (BOOL)isWaitPay {
    BOOL isFinish = NO;
    for (YunOrderListModel *itemModel in self.yunOrderSubList) {
        if (itemModel.isSucceed && [itemModel.payType isEqualToString:@"LATER"]) {
            isFinish = YES;
        }
    }
    return !isFinish && self.isSucceed && [self.payMode isEqualToString:@"POST_PAY"];
}
- (CGFloat)cellHeight {
    if (_cellHeight == 0) {
        _cellHeight = 68;
    }
    return _cellHeight;
}
@end
